﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Sublimation
{
    class PreviewTowerItem : MenuItemSurf
    {
        protected Tower originTower;
        public Tower OriginTower
        {
            set { originTower = value; }
            get { return originTower; }
        }
        // if true item displayed with tower image otherwise unavailable image
        protected PreviewTowerKind kind;
        public PreviewTowerKind Kind
        {
            set { kind = value; }
            get { return kind; }
        }

        public PreviewTowerItem(WorldProperties worldProperties, GameObject parent, Vector2 position, Vector2 origin,PreviewTowerKind kind, Tower aTower)
            :base(worldProperties,parent,position,origin)
        {
            originTower = aTower;
            this.kind = kind;
        }

        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            if (kind == PreviewTowerKind.Built)
            {
                Sprite = builtTower;
                if (ItemStatus == MenuItemStatus.Selected)
                {
                    spriteBatch.Begin(SpriteBlendMode.AlphaBlend);
                    spriteBatch.Draw(selectTower, Position, null, towerColor, Rotation, Origin, 1.0f, SpriteEffects.None, 1.0f);
                    spriteBatch.End();
                }
            }
            else if (kind == PreviewTowerKind.Unbuilt)
            {
                Sprite = unbuiltTower;
            }
            else if (kind == PreviewTowerKind.Add)
            {
                Sprite = addItem;
            }
        }
    }
}
